using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
using HourglassSystem;

public class MapManager : SingletonMonoBehaviour<MapManager>
{
    public TimeLineManager[] _timeLine;

    private void Awake()
    {
        INI_Singleton();
        INI_TimeLine();
    }

    private void Start()
    {

    }

    private void Update()
    {
        if (Keyboard.current.digit1Key.wasPressedThisFrame)
        {
            SwitchTimeLine(0);
        }
        if (Keyboard.current.digit2Key.wasPressedThisFrame)
        {
            SwitchTimeLine(1);
        }
        if (Keyboard.current.digit3Key.wasPressedThisFrame)
        {
            SwitchTimeLine(2);
        }
        if (Keyboard.current.digit4Key.wasPressedThisFrame)
        {
            SwitchTimeLine(3);
        }
        if (Keyboard.current.digit5Key.wasPressedThisFrame)
        {
            SwitchTimeLine(4);
        }
    }

    private void INI_TimeLine()
    {
        for (int i = 0; i < _timeLine.Length; i++)
        {
            _timeLine[i].INI_TimeLine(i);
        }
        _timeLine[0].SwitchIn();
    }

    public void SwitchTimeLine(int timeLineCode)
    {
        //1969 = 1 switch
        for (int i = 0; i < _timeLine.Length; i++)
        {
            _timeLine[i].SwitchOut();
        }
        _timeLine[timeLineCode].SwitchIn();
    }
}
